import { createBrowserRouter } from 'react-router-dom'

import Login from '../pages/Login'
import Layout from '../pages/Layout'
import Home from '../pages/Home'
import BlogDetail from '../pages/BlogDetail'
import Information from '../pages/Information'
import Personal from '../pages/Personal'
import Register from '../pages/Register'
import Publish from '@/pages/Publish'
import EditInfo from '@/pages/EditInfo'
import Setting from '@/pages/Setting'
import AuthRoute from '@/components/AuthRoute'
import ForgetPassword from '@/pages/Login/components/ForgetPassword'
import Page404 from '@/pages/Page404'
import SearchBlog from '@/pages/SearchBlog'
import BlogList from '@/pages/BlogList'


const router = createBrowserRouter([
  {
    path: '/',
    element: <AuthRoute><Layout /></AuthRoute>,
    children: [
        {
          index: true,
          element: <Home />,
        },
          {
            path: '/detail',
            element: <BlogDetail />,
          },
          {
            path: '/information',
            element: <Information />,
          },
          {
            path: '/personal',
            element: <Personal />,
          },
          {
            path: '/publish',
            element: <Publish/>,
          },
          {
            path: 'editinfo',
            element: <EditInfo/>
          },
          {
            path: 'setting',
            element: <Setting/>
          },
          {
            path: 'search',
            element: <SearchBlog/>
          },
          {
            path: 'bloglist',
            element: <BlogList/>
          }
    ]
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '/forgetpassword',
    element: <ForgetPassword />,
  },
  {
    path: '/register',
    element: <Register />,
  },
  {
    path: '*',
    element: <Page404/>
  }
])

export default router